import URL from '@/config/url'
import utils from '@/utils/utils'

export default {
	// 获取token
	getToken(params = {}) {
		let data = {
			code: params.code,      // *微信code(string)
			nickName:params.nickName,
			avatarUrl:params.avatarUrl,
			openid:params.openid,
			unionid:params.unionid,
			wx_access_token:params.wx_access_token,
			sence:params.sence,//不传为微信登录，企业微信传qywx
			share_id:params.share_id, //分享的精英冠管家user_id
		}
		
		return utils.uniRequest({ url: URL.BASE + '/base/loginwx', data })
	},
	
	// 绑定用户手机号码
	bindUserPhone(params = {}) {
		let data = {
			openid: params.openid,
			encryptedData: params.encryptedData,     // *加密信息-手机号(string)
			iv: params.iv,                           // *iv(string)
			u_encryptedData:params.u_encryptedData,
			share_uid:params.share_uid,
			mobile:params.mobile,
			smscode:params.smscode,
			nickName:params.nickName,
			avatarUrl:params.avatarUrl,
		}
		return utils.uniRequest({ url: URL.BASE + '/base/bindmobile', data })
	},
	// 手机获取验证码
	getPhonecode(params = {}) {
		let data = {
			mobile: params.mobile,
		}
		return utils.uniRequest({ url: URL.BASE + '/base/sendsms', data })
	},
	
	// 手机号码登录
	getUserPhone(params = {}) {
		let data = {
			mobile: params.mobile,
			sms_code: params.sms_code,
			share_id:params.share_id, //分享的精英冠管家user_id
		}
		return utils.uniRequest({ url: URL.BASE + '/base/login', data })
	},
	


}